﻿using Microsoft.Extensions.Primitives;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations.Schema;
using TencentCloud.Iotcloud.V20180614.Models;
using TencentCloud.Scf.V20180416.Models;
using ZenSystemService.Api.DTOs;

namespace ZenSystemService.Api.Entities
{

      /// <summary>
    /// 课程类型
    /// </summary>
    public class CourseType
    {

        public int CourseTypeId { get; set; }


        /// <summary>
        /// 机构ID
        /// </summary>
        public int InstitutionId { get; set; }

        /// <summary>
        /// 名称
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 上限人数
        /// </summary>
        public int? MaximumPeople { get; set; }


        public string? Enabled { get; set; }


        /// <summary>
        /// 私教课=1  团课=2  评估课=3
        /// </summary>
        public int Type { get; set; }


        public decimal Price { get; set; }
    }

    /// <summary>
    /// 课程信息
    /// </summary>
    public class Course
    {
        public int CourseId { get; set; }

        /// <summary>
        /// 课程编号
        /// </summary>
        public string CourseNumber { get; set; }


        /// <summary>
        /// 教练ID
        /// </summary>
        public int CoachId { get; set; }


        /// <summary>
        /// 代课教练
        /// </summary>
        public int? SubstituteCoachId { get; set; }


        /// <summary>
        /// 教练信息
        /// </summary>
        [NotMapped]
        public UserInfoResponse CoachInfo { get; set; }


        /// <summary>
        /// 开始时间
        /// </summary>
        public DateTime StartTime { get; set; }


     
        /// <summary>
        /// 课程时长(分钟)
        /// </summary>
        public int CourseDuration { get; set; }


        /// <summary>
        /// 结束时间
        /// </summary>
        public DateTime EndTime { get; set; }


        /// <summary>
        /// 课程状态  未开始 ->进行中->已结束
        /// </summary>
        public int CourseStatus { get; set; } = 0;

        /// <summary>
        /// 课程状态 名称
        /// </summary>
        [NotMapped]
        public string CourseStatusTxt { get; set; }

        /// <summary>
        /// 课程类型Id
        /// </summary>
        public int CourseTypeId { get; set; }

        public CourseType CourseTypeInfo { get; set; }
        public string? Enabled { get; set; }


        public int? CreatedUserID { get; set; }


        public DateTime? CreatedDate { get; set; }

        /// <summary>
        /// 机构ID
        /// </summary>
        public int InstitutionId { get; set; }

    }

    /// <summary>
    /// 代课记录
    /// </summary>
    public class SubstituteCourseRecord
    { 
        public int SubstituteCourseRecordId { get; set; }

        public int CourseId { get; set; }

        /// <summary>
        /// 代课教练
        /// </summary>
        public int SubstituteCoachId { get; set; }

        /// <summary>
        /// 确认状态 0=未确认 1=已确认
        /// </summary>
        public int ConfirmStatus { get; set; }

        public int? CreatedUserID { get; set; }

        public DateTime? CreatedDate { get; set; }
    }



    /// <summary>
    /// 课程学员
    /// </summary>
    public class CourseTrainee
    { 
        public int CourseTraineeId { get; set; }


        /// <summary>
        /// 课程ID
        /// </summary>
        public int CourseId { get; set; }

        /// <summary>
        /// 学员ID
        /// </summary>
        public int TraineeId { get; set; }

        [NotMapped]
        public UserInfoResponse TraineeInfo { get; set; }
        


        /// <summary>
        /// 上课签到时间
        /// </summary>
        public DateTime? AttendClassSignTime { get; set; }


        /// <summary>
        /// 下课签到时间
        /// </summary>
        public DateTime? FinishClassSignTime { get; set; }


        public string? SaveImage { get; set; }


        public string? Enabled { get; set; }
    }

    /// <summary>
    /// 取消预约课程
    /// </summary>
    public class CancelReservationCourse
    { 
        public int CancelReservationCourseId { get; set; }

        public int CourseTraineeId { get; set; }

        public int CancelUserId { get; set; }

        public DateTime CancelTime { get; set; }

    }

    /// <summary>
    /// 课程训练项
    /// </summary>
    public class CourseTrainingItem
    {
        public int CourseTrainingItemId { get; set; }

        /// <summary>
        /// 课程ID
        /// </summary>
        public int CourseId { get; set; }

        /// <summary>
        /// 训练项ID
        /// </summary>
        public int TrainingItemId { get; set; }


        /// <summary>
        /// 训练项信息
        /// </summary>
        public TrainingItem TrainingItemInfo { get; set; }

        /// <summary>
        /// 开始训练时间
        /// </summary>
        public DateTime? StartTrainingTime { get; set; }


        /// <summary>
        /// 结束训练时间
        /// </summary>
        public DateTime? EndTrainingTime { get; set; }


        /// <summary>
        /// 课程训练项状态
        /// </summary>
        public int CourseTrainingItemState { get; set; }


        [NotMapped]
        public string CourseTrainingItemStateTxt { get; set; }

        /// <summary>
        /// 次数
        /// </summary>
        public int? Count { get; set; }
    }


    /// <summary>
    /// 学员课程训练表
    /// </summary>
    public class TraineeCourseTraining
    {
        public int TraineeCourseTrainingId {  get; set; }
        public int? ProductId { get; set; }
        public Product Product { get; set; }

        /// <summary>
        /// 课程ID
        /// </summary>
        public int CourseId { get; set; }
        public Course Course { get; set; }

        /// <summary>
        /// 学员ID
        /// </summary>
        public int TraineeId { get; set; }
        public User Trainee { get; set; }

        public string? Status { get; set; } = "1"; //插入是有效标记，训练完标记为0
        /// <summary>
        /// 课程训练项Id
        /// </summary>
        public int TrainingItemId { get; set; }
        public TrainingItem TrainingItem { get; set; }

        /// <summary>
        /// 训练报表Id
        /// </summary>
        public int? TrainingReportId { get; set; }
        //public int Sequence { get; set; } = 0;

        public DateTime? CreatedDate { get; set; }
    }
}
